package
{
	import MyComponent.MyButton;
	import MyComponent.MyPercentBar;
	import MyComponent.MyScrollBar;
	import MyComponent.MyScrollPanel;
	
	import fl.controls.Button;
	import fl.core.UIComponent;
	
	import flash.display.DisplayObject;
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	import flash.utils.Timer;
	
	[SWF(backgroundColor=0x000000,width=760,height=600)]
	public class MyComponent extends Sprite
	{
		//[Embed(source="testPic.jpg")]
		public var testPic:Class;
		
		public var testComp:MyButton
		
		public function MyComponent()
		{
			var loader:Loader=new Loader;
			var request:URLRequest=new URLRequest("MyButton.swf");
			var lc:LoaderContext=new LoaderContext(false,ApplicationDomain.currentDomain);
			loader.load(request,lc);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadOverHandler);
		}
		
		private function loadOverHandler(e:Event):void
		{
			testComp=new MyButton();
			this.addChild(testComp);
			testComp.addEventListener(MouseEvent.MOUSE_DOWN,clickHandler);
			/*testComp=new MyPercentBar();
			this.addChild(testComp);
			testComp.runManSkin="testRunMan";
			var timer:Timer=new Timer(100);
			timer.addEventListener(TimerEvent.TIMER,timerHandler);
			timer.start();*/
		}
		
		private function clickHandler(e:MouseEvent):void
		{
			trace("ok");
		}
		
		/*private function timerHandler(e:TimerEvent):void
		{
			if(testComp.nowPercent<100)
			{
				testComp.nowPercent+=1;
			}
			else
			{
				testComp.nowPercent=0;
			}
		}*/
		
		
	}
}